package com.jsaas.controller.base;

import javax.servlet.http.HttpServletRequest;

import com.jfinal.core.Controller;
import com.jfinal.kit.Kv;
import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jsaas.core.qparams.PageQueryParams;
import com.jsaas.core.qparams.QueryParams;
import com.jsaas.core.qparams.QueryParamsUtils;

/**   
* @Title: BaseController.java 
* @Package com.jsaas.sys.controller 
* @Description: TODO(用一句话描述该文件做什么) 
* @author tuozq 
* @date 2017年11月3日 上午10:49:30 
* @version V1.0   
*/
public abstract class BaseController extends Controller {
	
	public PageQueryParams initPageParams(HttpServletRequest request, String sqlkey){
		return QueryParamsUtils.initPageParams(request, sqlkey);
	}
	
	public Kv getAllParams(HttpServletRequest request){
		return QueryParamsUtils.getAllParams(request);
	}
	
	public void renderJson(Page pagedata){
		renderJson(Ret.ok().set("total", pagedata.getTotalRow()).set("rows", pagedata.getList()));
	}
	
}
